trashmonitor: change trash monitoring process
authorRazvan Chitu <razvan.ch95@gmail.com>
Mon, 14 Mar 2016 09:55:00 +0000 (11:55 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 25 Mar 2016 03:20:14 +0000 (23:20 -0400)
commit65687ba3921f0d5db8b17a85a526a906b614fa0f
tree9074370606bedf1c83d6ac5424a1dea5a87a8b60
parent40e777ae30d0dcd14dd615958f3ebfa53e5f069b
trashmonitor: change trash monitoring process

The trash is monitored for state changes - going from empty to non-empty and the
other way round. Monitoring is done by handling change signals from a regular
file monitor. On each signal, an enumeration of the trash contents is started in
order to see if it is empty or not. This causes issues when many files are
trashed, because the gvfs trash backend is flooded with enumeration requests,
resulting in CPU usage spikes. In order to fix this, the "item-count" attribute
of the trash should be queried instead.

Replace asynchronous enumeration with asynchronous information query and update
the trash state based on the "item-count" attribute. Emit state change signal
only when the state actually changes.

https://bugzilla.gnome.org/show_bug.cgi?id=763600
gtk/gtktrashmonitor.c